package com.hs.telepass.utils;

import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import com.hs.telepass.manager.PreferencesManager;

import java.util.Locale;

/**
 * Created by mei on 2014/11/24.
 */
public class LanguageUtil {
    public static void setLanguage(Context context) {
        Resources resources = context.getResources();
        Configuration config = resources.getConfiguration();
        DisplayMetrics dm = resources.getDisplayMetrics();
        boolean isChinese = PreferencesManager.getInstance().isLanguageChinese();
        if(!isChinese){
            config.locale = Locale.ENGLISH;
        }else{
            config.locale = Locale.CHINESE;
        }
        resources.updateConfiguration(config, dm);

    }
}
